<?php

class Application_Model_HandleSpecificationsService
extends Application_Model_BaseService
{
    protected $dbTableName = 'Application_Model_DbTable_HandleSpecs';
    protected $modelName = 'Application_Model_HandleSpecification';
	private   static $instance = null;
    
    public static function getInstance(){
        if (Application_Model_HandleSpecificationsService::$instance == null)
            Application_Model_HandleSpecificationsService::$instance = 
                new Application_Model_HandleSpecificationsService();
        
        return Application_Model_HandleSpecificationsService::$instance;
    }
    
    public function listAll(){
        $table = $this->getDbTable(); 
        $select = $table->select()
                    ->setIntegrityCheck(false)
                    ->from('handle_specs', array('id', 'name', 'base_width', 'handle_width', 'capture'))
                    ->joinLeft(
                        'pictures',
                        'handle_specs.picture_id = pictures.id',
                        array('file_name')
                    );
                    
		$rows = $table->fetchAll($select);
        return $rows->toArray();
    }
}

